<template>
  <div class="pagination-container" v-show="presenter.page.total>0">
    <el-pagination
        @size-change="changeSize"
        @current-change="changePage"
        :current-page="presenter.page.page"
        :page-sizes="[5, 10, 20, 30, 50, 100]"
        :page-size="presenter.page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="presenter.page.total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 主页
      presenter: null
    }
  },
  created() {
    this.presenter = this.getPresenter()
  },
  methods: {
    getPresenter(parent = this.$parent) {
      if (parent.IS_ESJ_CRUD) {
        return parent
      } else {
        return this.getPresenter(parent.$parent)
      }
    },
    changeSize(e) {
      this.presenter.changePageSize(e)
    },
    changePage(e) {
      this.presenter.changeCurrentPage(e)
    }
  }
}
</script>
